import React, { Component } from 'react'
import PureRenderMixin from 'react-addons-pure-render-mixin'

import SearchInput from '../SearchInput'

import './style.less'

class SearchHeader extends Component {
  constructor(props) {
    super(props);
    this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this);
  }

  handleBack() {
    window.history.back();
  }

  render() {
    const params = this.props.params;
    console.log(params);
    return (
      <div id="search-header" className="clear-fix">
        <span className="back-icon float-left" onClick={this.handleBack.bind(this)}>
          <i className="icon-chevron-left"></i>
        </span>
        <div className="input-container">
          <i className="icon-search"></i>
          &nbsp;
          <SearchInput value={params.keyword || ''}/>
        </div>
      </div>
    )
  }
}

export default SearchHeader
